package com.farmpost.server.controller;


import com.farmpost.server.pojo.RespBean;
import com.farmpost.server.pojo.UserMaterials;
import com.farmpost.server.service.IUserMaterialsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户相关资料表 前端控制器
 * </p>
 *
 * @author king
 * @since 2022-04-03
 */
@RestController
@RequestMapping("/user-materials")
public class UserMaterialsController {

    @Autowired
    private IUserMaterialsService iUserMaterialsService;

    @ApiOperation(value = "查询用户资料")
    @GetMapping("/getUSerMaterials")
    public UserMaterials getUSerMaterials() {
        return iUserMaterialsService.getUSerMaterials();
    }

    @ApiOperation(value = "修改用户资料")
    @PostMapping("/updateUserMaterials")
    public RespBean updateUserMaterials(@RequestBody UserMaterials userMaterials) {
        return iUserMaterialsService.updateUserMaterials(userMaterials.getIsStuCertification(),userMaterials.getSelfIntroduction(),userMaterials.getGreatCount(),userMaterials.getMyFanCount(),userMaterials.getMyFocusCount());
    }

    @ApiOperation(value = "插入用户资料信息")
    @PutMapping("/insertUserMaterials")
    public RespBean insertUserMaterials(@RequestBody UserMaterials userMaterials) {
        return iUserMaterialsService.insertUserMaterials(userMaterials);
    }

    @ApiOperation(value = "删除用户资料")
    @DeleteMapping("/deleteUserMaterials")
    public RespBean deleteUserMaterials(@RequestParam() Integer userId) {
        return iUserMaterialsService.deleteUserMaterials(userId);
    }
}
